// 文本 json - 示例 2
package main

import (
	"encoding/json"
	"fmt"
)

type Server struct {
	ServerName 	string
	ServerIP	string
}

type ServersLice struct {
	Servers []Server
}

func main() {
	var s ServersLice
	s.Servers = append(s.Servers, Server{ServerName:"Shanghai_VPN", ServerIP:"127.0.0.1"})
	s.Servers = append(s.Servers, Server{ServerName:"Beijing_VPN", ServerIP:"127.0.0.1"})
	b, err := json.Marshal(s)
	if err != nil {
		fmt.Println("json err:", err)
	}
	fmt.Println(string(b))
}
/*
输出：
{"Servers":[{"ServerName":"Shanghai_VPN","ServerIP":"127.0.0.1"},{"ServerName":"Beijing_VPN","ServerIP":"127.0.0.1"}]}
*/